#include "../dependency/StatusCodes.h"
#include "GlobalDefines.h"

class ErrorLookupTable {
public:

    static std::string lookup(int errorNumber) {
        switch (errorNumber) {
            case DATABASE_ALREADY_EXISTS:
                return "DATABASE_ALREADY_EXISTS";
            case PARSE_FAILED:
                return "SYNTAX ERROR";
            case DATABASE_NOT_OPEN:
                return "DATABASE_NOT_OPEN";
            case INVALID_PAGE:
                return "INVALID PAGE";
            case TABLE_EXISTS:
                return "TABLE EXISTS";
            case TABLE_NOT_FOUND:
                return "TABLE NOT FOUND";
            case DISK_PAGE_READ_ERROR:
                return "DISK_PAGE_READ_ERROR";
            case CACHE_IS_OFF:
                return "CACHE_IS_OFF";
            case CACHE_IS_ALREADY_ON:
                return "CACHE_IS_ALREADY_ON";
            case DATABASE_DOES_NOT_EXIST:
                return "DATABASE_DOES_NOT_EXIST";
            case CLOSE_OPENED_DATABASE:
                return "CLOSE_OPENED_DATABASE";
            case DISK_FILE_OPEN_ERROR:
                return "DISK_FILE_OPEN_ERROR";
            case DISK_PAGE_WRITE_ERROR:
                return "DISK_PAGE_WRITE_ERROR";
            case DATABASE_ALREADY_OPEN:
                return "DATABASE_ALREADY_OPEN";
                
            case FRAME_DOESNT_EXITS:
                return "FRAME_DOESNT_EXITS";
            case SUCCESS:
                return "SUCCESS";

            default:
                return "UNKNOWN ERROR NUMBER";
        }
    }

    static std::string pageType(int pageTypeNum) {
        switch (pageTypeNum) {
            case TYPE_DB_MAIN_HEADER_PAGE:
                return "TYPE_DB_MAIN_HEADER_PAGE";
            case TYPE_DIRECTORY_HEADER_PAGE:
                return "TYPE_DIRECTORY_HEADER_PAGE";
            case TYPE_DIRECTORY_PAGE:
                return "TYPE_DIRECTORY_PAGE";
            case TYPE_DATA_PAGE:
                return "TYPE_DATA_PAGE";
            case TYPE_INDEX_PAGE:
                return "TYPE_INDEX_PAGE";
            case TYPE_LEAF_PAGE:
                return "TYPE_LEAF_PAGE";
            case TYPE_INDEX_HEADER_PAGE:
                return "TYPE_INDEX_HEADER_PAGE";
            case NO_PAGE:
                return "NO_PAGE";
            case TYPE_UNKNOWN_PAGE:
            default:
                return "UNKNOWN_PAGE_TYPE";
        }
    }

};
